package com.flot.yazb.aop.stub;

import com.google.gson.annotations.SerializedName;

import java.io.Serializable;


public class RMResponse<T extends Serializable> implements RMResult<T> {

    private final static long serialVersionUID = 1L;

    @Override
    public String message() {
        return message;
    }

    @Override
    public String code() {
        return status;
    }

    @Override
    public T contentMsg() {
        return content;
    }

    @Override
    public boolean verify() {
        return CodeStub.B_OK.equals(code());
    }

    @Override
    public boolean finishGradua() {
        return CodeStub.B_FINISH_GRADUA.equals(code());
    }

    @Override
    public boolean startGradua() {
        return CodeStub.B_START_GRADUA.equals(code());
    }

    @Override
    public boolean failureToken() {
        return CodeStub.B_TOKEN_UNUSEFUL.equals(code());
    }

    @Override
    public boolean changePassword() {
        return CodeStub.B_PASSWORD_CHANGE.equals(code());
    }

    @Override
    public boolean isSetInFailed() {
        return CodeStub.B_SET_IN_FAILURED.equals(code()) || CodeStub.B_SET_IN_FAILXP.equals(code());
    }

    public RMResponse() {
        content = null;
        status = "-1";
        message = "";
    }

    public RMResponse(String code, String message) {
        this.status = code;
        this.message = message;
    }


    @SerializedName("code")
    public String status;
    public String message;
    @SerializedName("data")
    public T content;

}
